package com.cahnggou.filter;

import java.net.URL;

/**
 * @ClassName URLFilter
 * @Description
 * @Author Mr.L
 * @Date 19:17 2019/11/24
 * @Version 2.1
 **/
public class URLFilter {

    // 无需拦截的url
    private static String NothasAuthorizeUrl = "/api/user/add/,/api/user/login";

    /**
     * 判断是否是受保护的资源
     * @param uri
     * @return
     */
    public static boolean hasAuthorize(String uri){
        String[] uris = NothasAuthorizeUrl.split(",");
        for (String url : uris){
            if (uri.startsWith(url)){
                // 无需登录
                return true;
            }
        }
        return false;
    }
}
